home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / ctutor2 / strings.c < prev    next >
Text File  |  1985-02-05  |  640b  |  26 lines

  1. main()
  2. {
  3. char name1[12],name2[12],mixed[25];
  4. char title[20];
  5.  
  6.    strcpy(name1,"Rosalinda");
  7.    strcpy(name2,"Zeke");
  8.    strcpy(title,"This is the title.");
  9.  
  10.    printf("     %s\n\n",title);
  11.    printf("Name 1 is %s\n",name1);
  12.    printf("Name 2 is %s\n",name2);
  13.  
  14.    if(strcmp(name1,name2)>0)  /* returns 1 if name1 > name2 */
  15.       strcpy(mixed,name1);
  16.    else
  17.       strcpy(mixed,name2);
  18.  
  19.    printf("The biggest name alpabetically is %s\n",mixed);
  20.  
  21.    strcpy(mixed,name1);
  22.    strcat(mixed,"  ");
  23.    strcat(mixed,name2);
  24.    printf("Both names are %s\n",mixed);
  25. }
  26.